import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import postCssPxToRem from 'postcss-pxtorem'

export default defineConfig({
	plugins: [
		uni(),
	],
	css: {
		postcss: {
			plugins: [
				postCssPxToRem({
					// 自适应，px>rem转换
					rootValue: 32,
					propList: ['*'], // 需要转换的属性，这里选择全部都进行转换
					selectorBlackList: ['norem'], // 过滤掉norem-开头的class，不进行rem转换，这个内容可以不写
				}),
			],
		},
	},
	server: {
		proxy: {
			'/apiDev': {
				target: 'http://localhost:8888',
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/apiDev/, '')
			},
			'/api': {
				target: 'http://103.148.59.132:10001',
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, '')
			},

		}
	}
});